$(document)
		.ready(
				function() {
					var receiveListVue = new Vue({
						el : '#showReceiveMaterialDiv',
						data : {
							items : null
						},
						methods : {
							show : function(purchaseOrder) {
								openShowPurchaseOrderBox(purchaseOrder);
							}
						}
					});

					getReceiveMaterialList();

					function openShowPurchaseOrderBox(purchaseOrder) {
						var examePurchaseOrderBox =layer.open({
									type : 2,
									maxmin : true,
									title : '确认收货',
									offset : '4%',
									btnAlign : 'c',
									area : [ '70%', '92%' ],
									btn : [ '确认收货', '拒绝收货 ' ] // 只是为了演示
									,
									yes : function() {

										var data = {
											"purchaseOrderId" : purchaseOrder.purchaseOrderId,
											"state" : 6
										};

										baseUtil
												.httpSend(
														"purchaseOrder/receiveMaterialAjax",
														data, showExameResult);
										layer.close(examePurchaseOrderBox);

									},
									btn2 : function() {
										var data = {
											"purchaseOrderId" : purchaseOrder.purchaseOrderId,
											"state" : 7
										};
										baseUtil
												.httpSend(
														"purchaseOrder/receiveMaterialAjax",
														data, showExameResult);
										layer.close();
									},
									shadeClose : true, // 点击遮罩关闭
									content : SERVER_PRE_URL
											+ "purchaseOrder/getPurchaseOrderByPrimaryKeyReturnTo?purchaseOrderId="
											+ purchaseOrder.purchaseOrderId
											+ "&returnTo=showPurchaseOrder&remark=show"
								});
					}
		

					
					
					function showExameResult(result){
						if (result==1) {
							layer.msg('操作成功');
						}else {
							layer.msg('操作失败');
						}
						getReceiveMaterialList();
					}
					
					
					
					
					
					
					
					
					
					function getReceiveMaterialList() {
						var data = {
							"state" : 4
						};
						baseUtil
								.httpSend(
										"purchaseOrder/getPurchaseOrderListByStateAjax",
										data, showData);
					}

					function showData(data) {
						receiveListVue.items = data;
					}

				});